export class ElemCommon
{
    private static instance = null;
    public static getInstance() : ElemCommon
    {
        if(null == this.instance){
            this.instance = new ElemCommon();
        }
        return this.instance;
    }

    public addButtonClickEvent (node : cc.Node, target : cc.Node, component: string, handler : string, customData ?: string) {
        var eventHandler = new cc.Component.EventHandler();
        eventHandler.target = target;
        eventHandler.component = component;
        eventHandler.handler = handler;
        eventHandler.customEventData = customData;

        var clickEvents = node.getComponent(cc.Button).clickEvents;
        clickEvents.push(eventHandler);
    }
}